package com.team.abs.service;

import com.team.abs.entity.User;
//用于身份证的检查
public class check {
	
	public  static boolean check(User user) {
		return checkUid(user.getUid())&&checkUid(user.getName())&&checkUid(user.getTelephone());
	}
	public static boolean checkUid(String Uid) {
		if(Uid.length()!=18)return false;
		for(int i=0;i<Uid.length()-1;i++)
			if(Uid.charAt(i)>'9'||Uid.charAt(i)<'0')return false;
		if(Uid.charAt(17)=='X')return true;
		if(Uid.charAt(17)>'9'||Uid.charAt(17)<'0')return false;
		return true;
	}
	public static boolean checkName(String Name) {
		if(Name.length()==0||Name.length()>8)return false;
		return true;
	}
	
	public static boolean checkTel(String Tel) {
		if(Tel.length()!=11)return false;
		for(char c:Tel.toCharArray())
			if(c>'9'||c<'0')return false;
		return true;
	}
	
}
